package com.xdd.mybatis.dao;

import com.xdd.mybatis.bean.Employee;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author user_xdd
 * @Date 2022-01-21 14:19
 * @description
 */
public interface EmployeeMapper {
   Employee getEmpById(Integer id);
   public Long addEmp(Employee employee);

   public boolean updateEmp(Employee employee);

   public void deleteEmpById(Integer id);
   public Employee getEmpByMap(Map<String, Object> map);

   public Employee getEmpByIdAndLastName(@Param("id") Integer id, @Param("lastName") String lastName);

   public  List<Employee> getEmpByLastName(String LastName);
   public Map<String, Object>getEmpByIdReturnMap(Integer id);
   //多条记录封装一个map：Map<Integer,Employee>:键是这条记录的主键，值是记录封装后的javaBean
   //@MapKey:告诉mybatis封装这个map的时候使用哪个属性作为map的key
   @MapKey("id")
   public Map<String, Employee> getEmpByLastNameLikeReturnMap(String lastName);

}
